Unit BDijitBorderContainerUnit;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils, BDojoSessionUnit, BDijitLayoutWidgetUnit;

Type

{ BDijitBorderContainerClass }

//** A BorderContainer is a box with a specified size, such as
//** style="width: 500px; height: 500px;", that contains a child widget marked
//** region="center" and optionally children widgets marked region equal
//** to "top", "bottom", "leading", "trailing", "left" or "right". Children
//** along the edges will be laid out according to width or height dimensions
//** and may include optional splitters (splitter="true") to make them
//** resizable by the user. The remaining space is designated for the center
//** region. The outer size must be specified on the BorderContainer node.
//** Width must be specified for the sides and height for the top and bottom,
//** respectively. No dimensions should be specified on the center; it will
//** fill the remaining space. Regions named "leading" and "trailing" may
//** be used just like "left" and "right" except that they will be
//** reversed in right-to-left environments. For complex layouts, multiple
//** children can be specified for a single region. In this case, the
//** layoutPriority flag on the children determines which child is closer to
//** the edge (low layoutPriority) and which child is closer to the center
//** (high layoutPriority). layoutPriority can also be used instead of the
//** design attribute to conrol layout precedence of horizontal vs. vertical
//** panes.

 BDijitBorderContainerClass = Class(BDijitLayoutWidgetClass)
  Private
    bDesign: String;
    bGutters: Boolean;
    bPersist: Boolean;
    Procedure SetDesign(aValue: String);
    Procedure SetGutters(aValue: Boolean);
    Procedure SetPersist(aValue: Boolean);
  Public
    //** Which design is used for the layout: - "headline" (default) where the
    //** top and bottom extend the full width of the container - "sidebar" where
    //** the left and right sides extend from top to bottom.
    Property Design: String Read bDesign Write SetDesign;
    //** Give each pane a border and margin. Margin determined by
    //** domNode.paddingLeft. When false, only resizable panes have a gutter
    //** (i.e. draggable splitter) for resizing.
    Property Gutters: Boolean Read bGutters Write SetGutters;
    //** Save splitter positions in a cookie
    Property Persist: Boolean Read bPersist Write SetPersist;

    Constructor Build(Const aSession: BDojoSessionClass;
      Const aJSType: String = ''); Override;
End;

Implementation

{ BDijitBorderContainerClass }

Procedure BDijitBorderContainerClass.SetDesign(aValue: String);
Begin
  bDesign := aValue;
  SetConfig('design', aValue);
End;

Procedure BDijitBorderContainerClass.SetGutters(aValue: Boolean);
Begin
  bGutters := aValue;
  SetConfig('gutters', aValue);
End;

Procedure BDijitBorderContainerClass.SetPersist(aValue: Boolean);
Begin
  bPersist := aValue;
  SetConfig('persist', aValue);
End;

Constructor BDijitBorderContainerClass.Build(Const aSession: BDojoSessionClass;
  Const aJSType: String);
Begin
  If aJSType = '' Then Inherited Build(aSession, 'dijit.layout.BorderContainer')
  Else Inherited Build(aSession, aJSType);
End;

End.

